/**
 * @param {string} s
 * @param {number} n
 * @return {string}
 */

var reverseLeftWords = function (s, n) {
    s= s.split("")
    while (n) {
        let val = s.shift()
        s.push(val)
        n--
    }
    return s.join("")
};
console.log(reverseLeftWords("abcdefg", 2))